package com.xuetang9.demo.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.xuetang9.demo.ssm.dao.UserMapper;
import com.xuetang9.demo.ssm.domain.Resource;
import com.xuetang9.demo.ssm.domain.User;
import com.xuetang9.demo.ssm.domain.dto.LoginDTO;
import com.xuetang9.demo.ssm.service.UserService;

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {
		Exception.class }, readOnly = true, timeout = 2000)
@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;

	
	@Override
	public User login(LoginDTO loginDTO) {
		return userMapper.getByAccAndPwd(loginDTO.getAccount(), loginDTO.getPassword());
	}

	public void 转账() {
		取钱();
		存钱();
	}

	public void 取钱() {
	}

	public void 存钱() {
	}

	@Override
	public Page<User> AllPage(int pageNum, int pageSize) {
		Page<User> page = PageHelper.startPage(pageNum, pageSize);
		userMapper.All();
		return page;
	}

	
	@Override
	public List<User> All() {
		
		return userMapper.All();
	}

}
